<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
    String path = request.getContextPath();
			String basePath = request.getScheme() + "://"
					+ request.getServerName() + ":" + request.getServerPort()
					+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>添加教师</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
<style type="text/css">
body {
	font: normal 11px auto "Trebuchet MS", Verdana, Arial, Helvetica,
		sans-serif;
	color: #4f6b72;
	text-align: center;
	background: #E6EAE9;
}

#container {
	margin-left: auto;
	margin-right: auto;
	width: 550px;
	height: 600px;
	background: #f8f8f8;
	border: 2px solid #777;
	display: block;
	vertical-align: middle;
}

.ele {
	margin-top: 30px;
	margin-botton: 30px;
	text-align: center;
	width: 100%;
	display: block;
	vertical-align: middle;
}
</style>
<script type="text/javascript" src="./js/My97DatePicker/WdatePicker.js" defer="defer"></script>
<script type="text/javascript">
function checkData(){
	var name = document.getElementById("teacherName").value.trim();
	var sex = document.getElementById("sex").value.trim();
	var birthDate = document.getElementById("birthDate").value.trim();
	var grade = document.getElementById("grade").value.trim();
	var courseName = document.getElementById("courseName").value.trim();
	var rank = document.getElementById("rank").value.trim();
	var des = document.getElementById("des").value.trim();
	if(grade !="" && name !="" && sex !="" && birthDate !="" && courseName !="" && rank !="" && des !=""){	
			return true;					
	}else{
		alert("请填写完整！");
		return false;
	}
}

</script>
</head>

<body>
	<h2>添加老师信息</h2>
	<div id="container">
		<form name="courseForm" method="post"
			action="./servlet/TeacherManageServlet?action=add"
			onsubmit="return checkData()">
			<div class="ele">
				<label> 姓名： </label> <input type="text" name="teacherName"
					id="teacherName">
			</div>
			<div class="ele">
				<label> 性别： </label> <input type="radio" name="sex" value="0">
				男 <input type="radio" name="sex" value="1"> 女
			</div>
			<div class="ele">
				<label> 出生日期： </label> <input type="text" name="birthDate"
					id="birthDate" readonly="readonly"> 
					<img onclick="WdatePicker({el:'birthDate'})" src="./js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
			</div>

			<div class="ele">
				<label> 所在年级： </label> <select name="grade" id="grade">
					<option value="choose" selected="selected">请选择年级</option>
					<option value="01">初中一年级</option>
					<option value="02">初中二年级</option>
					<option value="03">初中三年级</option>
					<option value="04">高中一年级</option>
					<option value="05">高中二年级</option>
					<option value="06">高中三年级</option>
				</select> &nbsp;&nbsp;&nbsp;&nbsp; <label> 所教科目： </label> <select
					name="courseName" id="courseName">
					<option value="choose" selected="selected">请选择科目</option>
					<option value="01">语文</option>
					<option value="02">数学</option>
					<option value="03">英语</option>
					<option value="04">物理</option>
					<option value="05">化学</option>
					<option value="06">生物</option>
					<option value="07">历史</option>
					<option value="08">政治</option>
					<option value="09">地理</option>
				</select>
			</div>
			<div class="ele">
				<label> 级别： </label> <select name="rank" id="rank">
					<option value="0">普通教师</option>
					<option value="1">年级组长</option>
				</select>
			</div>		
			<div class="ele">
			<label align="absmiddle">简介：</label>
			<textarea rows="6" cols="50" name="des" id="des">
			</textarea>
			</div>
			<div class="ele">
				<input type="submit" value="提交"> <input type="reset"
					value="取消">
			</div>
		</form>
	</div>
	<%
	    if (request.getAttribute("success") != null) {
			String str = (String) request.getAttribute("success");
			if ("true".equals(str)){
			    out.write("<script>alert('添加成功！')</script>");
			}
			else if("false".equals(str)){
			    out.write("<script>alert('添加失败！')</script>");
			}
	    }
	%>
</body>
</html>
